package info.gridworld.actor;

import java.awt.Color;

public class DyingFlower extends Flower{
	DyingFlower(){
		super();
	}
	
	private static final double DARKENING_FACTOR = 0.10;
	 
	public static void main(String[] args){
		ActorWorld world = new ActorWorld();
		world.add(new Bug());
		world.add(new DyingFlower());
        world.show();
	}
	
	@Override
	public void act(){
		 Color c = getColor();
	        int red = (int) (c.getRed() * (1 - DARKENING_FACTOR));
	        int green = (int) (c.getGreen() * (1 - DARKENING_FACTOR));
	        int blue = (int) (c.getBlue() * (1 - DARKENING_FACTOR));

	        setColor(new Color(red, green, blue));
	        
	        if(red == 0 && green == 0 && blue == 0){
	        	removeSelfFromGrid();
	        }
	}

}
